package com.lv.suyiyong.hfrwork.ui

import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.AppUtils
import com.lv.common.base.BaseActivity
import com.lv.common.utils.ARoutUtils
import com.lv.common.utils.StatusBarUtil
import com.lv.common.widget.textview.SpanTextView

import com.lv.service.webview.ConsealWebActivity
import com.lv.suyiyong.hfrwork.R
import com.lv.suyiyong.hfrwork.databinding.ActivityAboutMineBinding

/**
 * 作者： ygx
 * 创建日期：2023/5/6 10:33 AM
 * 签名： 天行健，君子以自强不息；地势坤，君子以厚德载物。
 * -    _              _           _     _   ____  _             _ _
 * -   / \   _ __   __| |_ __ ___ (_) __| | / ___|| |_ _   _  __| (_) ___
 * -  / _ \ | '_ \ / _` | '__/ _ \| |/ _` | \___ \| __| | | |/ _` | |/ _ \
 * - / ___ \| | | | (_| | | | (_) | | (_| |  ___) | |_| |_| | (_| | | (_) |
 * -/_/   \_\_| |_|\__,_|_|  \___/|_|\__,_| |____/ \__|\__,_|\__,_|_|\___/
 * <p>
 * You never know what you can do until you try !
 * ----------------------------------------------------------------
 * 描述：关于我们
 */
@Route(path = ARoutUtils.ABoutMineActivity)
class ABoutMineActivity : BaseActivity<ActivityAboutMineBinding>() {
    override fun getLayoutRes() = R.layout.activity_about_mine
    override fun initView() {
        super.initView()
        initStatusBar(this, true, true)
        ARouter.getInstance().inject(this)
        mBinding.apply {
            StatusBarUtil.setHeightAndPadding(this@ABoutMineActivity, titleBar)
            titleBar.onClickBackIcon { finish() }
            titleBar.setTitle("关于亨富然")

        }
    }


    override fun initConfig() {
        super.initConfig()
        mBinding.tvVersion.text = "版本：${AppUtils.getAppVersionName()}"

        mBinding.tvAgree.setTextColor("#242424")
        mBinding.tvAgree.setText(createSpanTexts(),
            SpanTextView.SpanClickListener { position ->
                if (position == 1) {
                    ConsealWebActivity.openUrl(this@ABoutMineActivity, "5")
                }else{
                    ConsealWebActivity.openUrl(this@ABoutMineActivity, "0")
                }
            })

    }


    override fun initData() {
        super.initData()

    }

    private fun createSpanTexts(): List<SpanTextView.BaseSpanModel>? {
        val spanModels: MutableList<SpanTextView.BaseSpanModel> = ArrayList()
        val textSpanModel = SpanTextView.TextSpanModel()
        textSpanModel.content = "        请遵守以下协议："
        spanModels.add(textSpanModel)
        val spanModel = SpanTextView.ClickSpanModel()
        spanModel.content = "《用户服务协议》"
        spanModels.add(spanModel)
//        val spanModelXK = SpanTextView.ClickSpanModel()
//        spanModelXK.content = "《软件许可使用协议》"
//        spanModels.add(spanModelXK)
        val spanModelconseal = SpanTextView.ClickSpanModel()
        spanModelconseal.content = "《隐私政策》"
        spanModels.add(spanModelconseal)

//        textSpanModel = TextSpanModel()
//        textSpanModel.content = "，未注册的手机号将自动创建速易甬账号"
//        spanModels.add(textSpanModel)
//        spanModel = ClickSpanModel()
//        spanModel.content = "Lucy"
//        spanModels.add(spanModel)
        return spanModels
    }

}